<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/jquery-3.4.1.min.js"></script>
    <!--    bootstrap5-->
    <!--    <link rel="stylesheet" href="/css1/bootstrap.min.css">-->
    <!--    <script src="/js1/bootstrap.min.js"></script>-->

    <!--    bootstrap3-->
    <link rel="stylesheet" href="/css/bootstrap.min.css">


    <link rel="stylesheet" href="/css/style.css">
    <link rel="stylesheet" href="/plugins/bootstraptable/bootstrap-table.min.css">
</head>
<body>
<div class="bgc">
    <div class="box">
        <h2>登录页面</h2>
        <hr>
        <form>
            <div class="form-group">
                <label for="userName">姓名</label>
                <input type="text" class="form-control" id="userName" placeholder="请输入姓名" name="name">
            </div>
            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" class="form-control" id="password" placeholder="请输入密码" name="password">
            </div>
            <button type="button" class="btn btn-primary" onclick="login();">登录</button>
        </form>
    </div>
</div>






<script src="/js/jquery-3.4.1.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/plugins/bootstraptable/bootstrap-table.min.js"></script>
<script src="/plugins/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>

<script>
    function login(){
        let name = $("#userName").val();
        let password = $("#password").val();
        console.log(name)
        console.log(password)
        $.ajax({
            url:"/webapi/login/user",
            data:{
                username:name,
                password:password
            }
        }).done(function (rs){
            if(rs > 0){
                //成功
                window.location.href = "/student/list"
            }else{
                alert("出错了，您的用户名和密码是乱写的吗？")
            }
        });
    }

</script>
</body>
</html>